home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 75 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.1 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: kanze@gabi.gabi-soft.fr (J. Kanze)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: auto_ptr again
  5. Date: 19 Jan 1996 09:33:25 PST
  6. Organization: GABI Software, Sarl.
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <KANZE.96Jan19124039@gabi.gabi-soft.fr>
  9. References: <ADxYD_mKQD@qsar.chem.msu.su> <4djrn4$js1@engnews1.Eng.Sun.COM>
  10.     <AUSTERN.96Jan18103535@isolde.mti.sgi.com>
  11. NNTP-Posting-Host: isolde.mti.sgi.com
  12. X-Original-Date: 19 Jan 1996 11:40:39 GMT
  13. In-Reply-To: austern's message of 18 Jan 1996 11:00:55 PST
  14. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  15.     iQBVAwUBMP/V+ky4NqrwXLNJAQEIIwH9F1Ny/L/0ByguVhwWfwG8JWuUFBqzaXWH
  16.     dJbgxkYnEEo9KhrWecPJmWB8I3nqSri/eDu4ZqIsFTKW1Zn8dz6SzA==
  17.     =Snmz
  18. Originator: austern@isolde.mti.sgi.com
  19.  
  20. In article <AUSTERN.96Jan18103535@isolde.mti.sgi.com> austern (Matt
  21. Austern) writes:
  22.  
  23. > In article <4djrn4$js1@engnews1.Eng.Sun.COM> clamage@Eng.Sun.COM (Steve Clamage) writes:
  24.  
  25. > > That point has been beaten to death in the C++ committee and also in
  26. > > this forum. Some people felt an auto_ptr should be able to have multiple
  27. > > owners, but people with experience with this kind of design persuaded
  28. > > the committee that auto_ptrs are too hard to use unless they can have
  29. > > only a single owner. Thus, ownership is transferred upon copying.
  30.  
  31. > > That is, single ownership is a deliberate design decision based on the
  32. > > semantics an auto-ptr should have. It is not an implementation issue.
  33.  
  34. > I thought it was generally agreed that auto_ptrs as currently defined
  35. > were broken---specifically, that the semantics of strict ownership,
  36. > constness, and the binding of temporary objects, ended up making an
  37. > auto_ptr nearly useless for returning a value from a function.  That's
  38. > unfortunate, since returning something from a function is one of the
  39. > situations when it's most important to have some safe wrapper class 
  40. > like auto_ptr.
  41.  
  42. The only thing I think where there was anything like universal agreement
  43. was that auto_ptr's are nearly useless unless you can copy a temporary
  44. auto_ptr object.  In the exact form that they are described in the
  45. standard, you cannot.  But there were a number of proposed solutions,
  46. most of which maintain the concept of strict ownership.
  47.  
  48. > I've spent a bit of time trying to come up with bright ideas for
  49. > fixing auto_ptr, but I don't really have any.  Reference-counted
  50. > pointers don't have this particular problem, though, and that might be
  51. > the best argument for putting rc_ptr in the standard in addition to
  52. > (or instead of) auto_ptr.
  53.  
  54. I use reference counted pointers a lot, but they have their own set of
  55. problems.  I can very well understand the committees reluctance to adapt
  56. them.
  57. -- 
  58. James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
  59. GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
  60. Conseils, itudes et rialisations en logiciel orienti objet --
  61.               -- A la recherche d'une activiti dans une region francophone
  62. ---
  63. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  64.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  65.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  66.